package br.ufrn.engcomp.arq.dominio;

/**
 * @author Claudio
 *
 */
import java.io.Serializable;

@SuppressWarnings("serial")
public abstract class Entidade implements Serializable {

	public abstract long getId();
	
	@Override 
	public int hashCode() { 
		final int prime = 31; 
		int result = 1; 
		result = prime * result + Long.signum(getId() ^ (getId() >>> 32)); 
		return result; 
	}
	
	@Override 
	public boolean equals(Object obj) { 
		if (this == obj) 
			return true; 
		if (obj == null) 
			return false; 
		if (getClass() != obj.getClass()) 
			return false; 
		Entidade other = (Entidade) obj; 
		if (getId() != other.getId()) 
			return false; return true; 
	} 
	
	public String getClassName() {
		String className = this.getClass().getName(); 
		return (String) className.subSequence(className.lastIndexOf(".")+1, className.length());
	}

}
